import { AddUserGroupModel } from "./models";
import req from "/@/api/req";

export enum Api {
  addUserGroup = "api/system/userGroups/addUserGroup", // 添加用户组
  authorizedUserToGroup = "api/system/userGroups/authorizedUserToGroup", // 添加授权
  cancelAuthorizedUserToGroup = "api/system/userGroups/cancelAuthorizedUserToGroup", // 取消授权
  deleteUserGroupByIds = "api/system/userGroups/deleteUserGroupByIds", // 删除用户组
  getUsersByGroupId = "api/system/userGroups/getUsersByGroupId", // 根据用户组id获取用户
  getGrpPage = "api/system/userGroups/page", // 获取用户组分页数据
  updateUserGroup = "api/system/userGroups/updateUserGroup", // 修改用户分组
}

export interface AddUserItemParams {
  userGroupId: string;
  userIds: Array<string>;
}
// 给用户添加授权
export function addUserToGroup(data: AddUserItemParams) {
  return req.post<boolean>({
    url: Api.authorizedUserToGroup,
    data,
  });
}
// 添加用户组
export function addUserGroup(data: AddUserGroupModel) {
  return req.post<boolean>({
    url: Api.addUserGroup,
    data,
  });
}
